package com.juzi.udp;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.Scanner;

public class ClientDemo1 {
    public static void main(String[] args) throws Exception {
        System.out.println("===========再启动客户端启动=========");
        DatagramSocket socket = new DatagramSocket();


        System.out.println("请输入");
        Scanner scanner = new Scanner(System.in);
        String string = scanner.next();
        byte[] buffer = string.getBytes();
        DatagramPacket packet = new DatagramPacket(buffer, buffer.length, InetAddress.getLocalHost(), 8888);

        socket.send(packet);

        socket.close();

    }
}
